package com.newer.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.newer.domain.Plan;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;

public interface PlanMapper extends BaseMapper<Plan> {

    @Select("select p.*,s.supplierName,u.realName from t_plan p inner join t_supplier s on p.supplierId=s.supplierId inner join t_user u on p.userId=u.userId where p.planId like CONCAT('%',#{planId},'%')")
    @Results({
            @Result(column = "planId",property = "planid"),
            @Result(column = "sumCount",property = "sumcount"),
            @Result(column = "sumPrice",property = "sumprice"),
            @Result(column = "approver",property = "approver"),
            @Result(column = "remark",property = "remark"),
            @Result(column = "planDate",property = "plandate"),
            @Result(column = "planState",property = "planstate"),
            @Result(column = "supplierName",property = "supplier.suppliername"),
            @Result(column = "realName",property = "user.realname"),
    })
    Page<Plan> selectPlan(Page page, String planId);


}